# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details

  include AuthenticatedSystem
  before_filter :login_required

  def initialize
    
  end

  # Scrub sensitive parameters from your log
  # filter_parameter_logging :password

  def modifica(objeto,hash)
    objeto.id = hash[:id].to_i
    objeto
  end

  audit(Areacurriculo,Avaliacaoarea,
        Basicarea,Bigarea,Campu,City,
        Colegio,Colegiotype,Condado,
        Conhecimentoarea,Country,Curso,
        Day,Desligamento,
        Desligamentogrupo,Disciplina,
        Disciplinatype,Documenttype,Ec,
        Estado,Fasematricula,Ingresso,
        Ingressogrupo,Level,Localtype,
        Month,Ocorrencia,Ocorrenciagrupo,
        Opcaotipo,Option,Organ,Organtype,
        Person,Place,Regimeletivo,Region,
        Sexo,Teacher,Titulo,Turno,User)

  protected
  def current_user
    @username ||= User.find_by_id(session[:user_id].to_i).login
    @user ||= User.find_by_id session[:user_id].to_i
  end

end
